Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding instrumentation support for mongo-driver/v2 #6539

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

AlaricWhitney
Copy link

Adding the mongo-driver/v2 instrumentation.

This is a copy/paste of the v1 instrumentation, and was modified to adhere to the mongo-driver/v2 requirements.

Notable differences:

  • mtest was removed in v2. Replaced with drivertest in the unit testing.

This addresses PR #6419

@AlaricWhitney AlaricWhitney requested a review from a team as a code owner December 28, 2024 17:52
Copy link

linux-foundation-easycla bot commented Dec 28, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 82.40000% with 22 lines in your changes missing coverage. Please review.

Project coverage is 68.6%. Comparing base (00786cc) to head (24b5f1e).
Report is 52 commits behind head on main.

Files with missing lines Patch % Lines
...ngodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go 80.2% 13 Missing and 5 partials ⚠️
...rg/mongo-driver/v2/mongo/otelmongo/test/version.go 60.0% 2 Missing ⚠️
...odb.org/mongo-driver/v2/mongo/otelmongo/version.go 60.0% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #6539     +/-   ##
=======================================
+ Coverage   68.5%   68.6%   +0.1%     
=======================================
  Files        200     204      +4     
  Lines      16768   16906    +138     
=======================================
+ Hits       11490   11606    +116     
- Misses      4933    4950     +17     
- Partials     345     350      +5     
Files with missing lines Coverage Δ
...godb.org/mongo-driver/v2/mongo/otelmongo/config.go 100.0% <100.0%> (ø)
...rg/mongo-driver/v2/mongo/otelmongo/test/version.go 60.0% <60.0%> (ø)
...odb.org/mongo-driver/v2/mongo/otelmongo/version.go 60.0% <60.0%> (ø)
...ngodb.org/mongo-driver/v2/mongo/otelmongo/mongo.go 80.2% <80.2%> (ø)

... and 3 files with indirect coverage changes

@dmathieu
Copy link
Member

cc @prestonvasquez for review?

Copy link
Contributor

@prestonvasquez prestonvasquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlaricWhitney Thank you for putting this together. I wanted to let you know that I'll be reviewing this in stages, as my schedule allows.

// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Package otelmongo instruments go.mongodb.org/mongo-driver/mongo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Package otelmongo instruments go.mongodb.org/mongo-driver/mongo.
// Package otelmongo instruments go.mongodb.org/mongo-driver/v2/mongo.

Comment on lines +6 to +7
// This package is compatible with v0.2.0 of
// go.mongodb.org/mongo-driver/mongo.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// This package is compatible with v0.2.0 of
// go.mongodb.org/mongo-driver/mongo.

MongoDB's Go Driver has a major version compatibility guarantee, so this information is necessary for v2.

Comment on lines +12 to +14
// This code was originally based on the following:
// - https://github.com/DataDog/dd-trace-go/tree/02f0449efa3cb382d499fadc873957385dcb2192/contrib/go.mongodb.org/mongo-driver/mongo
// - https://github.com/DataDog/dd-trace-go/tree/v1.23.3/ddtrace/ext
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update this to note that the code was copied from a specific instance of the v1 instrumentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants